//
//  TestViewController.m
//  Manager
//
//  Created by 彭凯敏 on 15/8/18.
//  Copyright (c) 2015年 52xiaoluo. All rights reserved.
//

#import "TestViewController.h"
#import "LoginViewController.h"
#import "MessageViewController.h"
#import "NetEngine.h"

@interface TestViewController ()
- (IBAction)clickLogin:(UIButton *)sender;
- (IBAction)clickMessage:(UIButton *)sender;

@property (weak, nonatomic) IBOutlet UITextField *hostTF;
@property (weak, nonatomic) IBOutlet UITextField *portTF;
- (IBAction)clickReset:(UIButton *)sender;

@end

@implementation TestViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    _hostTF.text = [[NetEngine shareInstance]hostStr];
    _portTF.text = [[NetEngine shareInstance]portStr];
    
    
}


- (IBAction)clickLogin:(UIButton *)sender {
    [[UserLogic shareInstance]logout];
}

- (IBAction)clickMessage:(UIButton *)sender {
    MessageViewController *message = [[MessageViewController alloc]init];
    
    [self.navigationController pushViewController:message animated:YES];
    
}

- (IBAction)clickReset:(UIButton *)sender {
    if ([_hostTF.text isEqualToString:@""]||[_portTF.text isEqualToString:@""]) {
        FailedShow(@"失败");
        return;
    }
    
    [[NetEngine shareInstance]resetHost:_hostTF.text andPort:_portTF.text];
    showAlert(@"修改成功", _hostTF.text);
    
}
@end
